import { Component } from 'react';
import {
  View,
  StyleSheet,
  ActivityIndicator,
  Text,
} from 'react-native';

class Loading extends Component {
  constructor(props) {
    console.log(props);
    super(props);
  }

  render() {
    return (this.props.loading && <View style={styles.loadingContainer}>
      <ActivityIndicator size="large" color="#0000ff" />
      <Text>加载中...</Text>
    </View>
    );
  }
}

const styles = StyleSheet.create({
  loadingContainer: {
    flex: 1,
    zIndex: 999,
    position: 'absolute',
    justifyContent: 'center',
    alignItems: 'center',
    alignSelf: 'center',
    backgroundColor: 'rgba(255, 255, 255, 0.8)', // 设置背景颜色和透明度
    padding: 10,
    borderRadius: 10,
  },
});

export default Loading;
